package dormouse.fx.metadata;

import java.net.URL;
import java.util.ResourceBundle;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

import org.biogroovy.models.Article;
import org.biogroovy.models.Journal;


public class PDFPanelController implements Initializable {

    @FXML //  fx:id="abstractFld"
    private TextArea abstractFld; // Value injected by FXMLLoader

    @FXML //  fx:id="abstractLbl"
    private Label abstractLbl; // Value injected by FXMLLoader

    @FXML //  fx:id="authorsFld"
    private TextField authorsFld; // Value injected by FXMLLoader

    @FXML //  fx:id="authorsLbl"
    private Label authorsLbl; // Value injected by FXMLLoader

    @FXML //  fx:id="createdDateFld"
    private TextField createdDateFld; // Value injected by FXMLLoader

    @FXML //  fx:id="createdDateLbl"
    private Label createdDateLbl; // Value injected by FXMLLoader

    @FXML //  fx:id="issueFld"
    private TextField issueFld; // Value injected by FXMLLoader

    @FXML //  fx:id="issueLbl"
    private Label issueLbl; // Value injected by FXMLLoader

    @FXML //  fx:id="journalFld"
    private TextField journalFld; // Value injected by FXMLLoader

    @FXML //  fx:id="journalLbl"
    private Label journalLbl; // Value injected by FXMLLoader

    @FXML //  fx:id="keywordsFld"
    private TextArea keywordsFld; // Value injected by FXMLLoader

    @FXML //  fx:id="keywordsLbl"
    private Label keywordsLbl; // Value injected by FXMLLoader

    @FXML //  fx:id="modDateFld"
    private TextField modDateFld; // Value injected by FXMLLoader

    @FXML //  fx:id="modDateLbl"
    private Label modDateLbl; // Value injected by FXMLLoader

    @FXML //  fx:id="pmidFld"
    private TextField pmidFld; // Value injected by FXMLLoader

    @FXML //  fx:id="pmidLbl"
    private Label pmidLbl; // Value injected by FXMLLoader

    @FXML //  fx:id="searchBtn"
    private Button searchBtn; // Value injected by FXMLLoader

    @FXML //  fx:id="titleFld"
    private TextField titleFld; // Value injected by FXMLLoader

    @FXML //  fx:id="titleLbl"
    private Label titleLbl; // Value injected by FXMLLoader

    @FXML //  fx:id="updateBtn"
    private Button updateBtn; // Value injected by FXMLLoader


    @Override // This method is called by the FXMLLoader when initialization is complete
    public void initialize(URL fxmlFileLocation, ResourceBundle resources) {

    }
    
    public void bind(Article article){
    	titleFld.setText(article.getTitle());
    	abstractFld.setText(article.getAbs());
    	pmidFld.setText(article.getPubmedId());
    	
    	Journal journal = article.getJournal();
    	if (journal != null){
	    	journalFld.setText(journal.getTitle());
	    	issueFld.setText(journal.getIssue());
    	}
    	
    	if (article.getMeshHeadings() != null && !article.getMeshHeadings().isEmpty()){
    		keywordsFld.setText(article.getMeshHeadings().toString());
    	}
    }
    
    public void updateAction(){
    	
    }
    
    public void searchAction(){
    	
    }

} 
